import { Controller, Delete, Get, Param, Post, Put } from "@nestjs/common";
import { ProductCreateDto } from "src/core/dto/product-create.dto";

@Controller('product')
export class ProductController {
    @Get()
    async searchUsers(): Promise<ProductCreateDto[]> {
        return [];
    }
    @Get(':id')
    getUser(@Param('id') id: string): Promise<ProductCreateDto> {
        return Promise.resolve({
            id,
            name: '二锅头',
            prict: 36,
            createTime: '2021-08-09 00:00:00',
            updateTime: '2026-08-16 00:00:00'
        })
    }
    @Post()
    createUser(): Promise<ProductCreateDto> {
        return Promise.resolve({
            id: '45',
            name: '二锅头',
            prict: 36,
            createTime: '2021-08-09 00:00:00',
            updateTime: '2026-08-16 00:00:00'
        })
    }
    @Put(':id')
    updateUser(@Param('id') id: string): Promise<ProductCreateDto> {
        return Promise.resolve({
            id,
            name: '二锅头',
            prict: 36,
            createTime: '2021-08-09 00:00:00',
            updateTime: '2026-08-16 00:00:00'
        })
    }
    @Delete(':id')
    deleteUsers(@Param('id') id: string): string {
        return `删除商品${id}`;
    }




}